#ifndef __ATMOS_LogManager_h__
#define __ATMOS_LogManager_h__

#include "ATMOS_Common.h"

#include <string>
#include <fstream>

#define ATMOS_LOG_INSERT( x )  { std::stringstream _ss; _ss << x; ATMOS::LogManager::getInstance()->log( _ss.str() ); }
#define ATMOS_LOG( x ) ATMOS_LOG_INSERT( x << std::endl );
#define ATMOS_LOG_FUNC() ATMOS_LOG( __FUNCTION__ );
#define ATMOS_LOGF( x ) ATMOS_LOG( "[" << __FUNCTION__ << "] \t" << x );


namespace ATMOS {

	//! Manages logging - NOTE: You MUST instantiate a LogManager instance when using ATMOS in your application
	/*! NOTE:  You must create a LogManager instance before doing anything with ATMOS, and that 
	 * instance must not be destroyed until all other ATMOS classes have been destroy and all 
	 * other ATMOS operations have ceased.
	 */
	class AtmosExport LogManager
	{
	public:
		LogManager( const std::string &filename );
		~LogManager();

		void log( const std::string &str );

		static LogManager *getInstance();

	private:
		std::ofstream mLog;

		static LogManager *sInstance;
	};

} // end namespace ATMOS

#endif